package com.bitoon.basketdudes.web;

import java.util.Properties;
import org.apache.log4j.Logger;

public class Config {

    public static Properties prop = new Properties();
    private Logger log = Logger.getLogger(Config.class);
    private static Config instanceConfig = null;

    public static Config getInstance() {
        if (instanceConfig==null) {
            instanceConfig = new Config();
            instanceConfig.loadProperties();
        }
        return instanceConfig;
    }

    private void loadProperties() {
        log.debug("loadProperties");
        ClassLoader loader = Config.class.getClassLoader();
        if (loader==null) {
            loader = ClassLoader.getSystemClassLoader();
        }

        String propFile = "basketdudes.properties";
        java.net.URL url = loader.getResource(propFile);

        try {
            prop.load(url.openStream());
        } catch (Exception e) {
            System.err.println("Could not load configuration file: " + propFile);
        }
    }



}
